<template>
  <div class="home">
    <van-swipe :autoplay="3000" indicator-color="white">
      <van-swipe-item v-for="item in images" :key="item">
        <img :src="item" class="swipe_img">
      </van-swipe-item>
    </van-swipe>
    <div class="tip_list">今天有{{qustion}}人提问，有{{onlookers}}人围观</div>
    <div class="title flex_space">
      <div class="min_title">最新</div>
      <div class="flex_start">
        <span class="min_font">更多</span>
        <van-icon name="arrow" size="15"></van-icon>
      </div>
    </div>
    <div class="panel-list" v-for="item in  list " :key="item.id" @click="getClick">
      <div class="card_header">
        <div class="flex_start">
          <div class="min_font">{{item.title}}</div>
        </div>
        <img v-if="item.img" :src="item.img" width="100" height="50">
      </div>
      <div class="card_header">
        <div class="min-size">{{item.name}}</div>
        <div class="min-size">
          <span>浏览{{item.browseNum}}人</span>
          <span>评论{{item.reviewNum}}人</span>
        </div>
      </div>
    </div>

    <div class="all">
      查看全部问答
      <van-icon name="arrow-down" size="15"></van-icon>
    </div>
    <div class="ertification" @click="ertification">
            <van-icon name="plus" size="18px" ></van-icon>
      </div>
  </div>
</template>
<script>
import {
  Tabbar,
  TabbarItem,
  Tag,
  Swipe,
  SwipeItem,
  Search,
  Icon,
  Lazyload,
  Button
} from 'vant'

export default {
  components: {
    [Tabbar.name]: Tabbar,
    [TabbarItem.name]: TabbarItem,
    [Swipe.name]: Swipe,
    [SwipeItem.name]: SwipeItem,
    [Tag.name]: Tag,
    [Icon.name]: Icon,
    [Search.name]: Search,
    [Lazyload.name]: Lazyload,
    [Button.name]: Button
  },
  data() {
    return {
      search: '',
      images: [
        'https://img.yzcdn.cn/public_files/2017/10/24/e5a5a02309a41f9f5def56684808d9ae.jpeg',
        'https://img.yzcdn.cn/public_files/2017/10/24/1791ba14088f9c2be8c610d0a6cc0f93.jpeg'
      ],
      qustion: 111,
      onlookers: 3333,
      list: [
        {
          id: '0',
          title: '大多数人们喜欢的户型有哪些?',
          name: '@测试',
          img:
            'https://gss1.bdstatic.com/9vo3dSag_xI4khGkpoWK1HF6hhy/baike/w%3D790/sign=1cf755a396ef76c6d0d2f922ad17fdf6/b03533fa828ba61e51f94fad4734970a304e5919.jpg',
          browseNum: 50,
          reviewNum: 20,
          totalAll: 666,
          tag: 1 //重磅
        },
        {
          id: '1',
          title: '学区房到底有什么好处?',
          name: '@张某某',
          browseNum: 150,
          reviewNum: 120,
          totalAll: 999,
          tag: 0 //热门
        },
        {
          id: '2',
          title: '下一个学区房在哪里?',
          name: '@大磊',
          browseNum: 150,
          reviewNum: 120,
          totalAll: 999,
          tag: 0 //热门
        }
      ]
    }
  },
  methods: {
    onSearch() {},
     ertification(){
        this.$router.push({
            path:'/releaseAnswer'
        })
      },
    getClick(){
          this.$router.push({
            path:'/answerDatls'
        })
    }
  }
}
</script>
<style lang="less">
.home {
  .swipe_img {
    width: 100%;
    height: 180px;
  }
  .tip_list {
    padding: 10px 10px;
    box-sizing: border-box;
    background-color: #fff;
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    font-size: 13px;
  }
  .title {
    padding: 10px 10px;
    box-sizing: border-box;
    .min_title {
      font-size: 13px;
    }
    .min_font {
      font-size: 14px;
    }
  }
  .panel-list {
    margin-bottom: 5px;
    background-color: #fff;
    border: 1px solid #e5e5e5;
    padding: 10px 10px;
    box-sizing: border-box;
    .card_header {
      display: flex;
      flex-direction: row;
      justify-content: space-between;
    }
    .card_footer {
      display: flex;
      flex-direction: row;
      justify-content: flex-start;
      font-size: 14px;
      padding: 10px 0;
      box-sizing: border-box;
      border-top: 1px solid #e5e5e5;
      margin-top: 5px;
    }
  }
  .all {
    margin-top: 20px;
    margin-bottom: 20px;
    text-align: center;
    font-size: 13px;
  }
   .ertification{
      position: fixed;
      bottom: 70px;
      right: 10px;
      width: 30px;
      height: 30px;
      border-radius: 50%;
      border: 1px solid red;
      background-color: #fff;
      line-height: 50px;
      font-size: 12px;
      text-align: center;
      color: red;
      cursor: pointer; 
      .van-icon{
          position: absolute;
          top: 6px;
          left: 6px;
      }
            
    }
}
.flex_space {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
}
.flex_start {
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
}

.min-size {
  font-size: 12px;
  color: #e3e3e3;
  margin-top: 10px;
}
</style>
